<?php

namespace frontend\models;

use Yii;
use yii\base\Model;
use frontend\models\User;

class Codes extends User
{

    /**
     * @inheritdoc
     */
	public $verifyCode;
    public $user_phone;



    public function rules()
    {
        return [
            [['verifyCode','user_phone'], 'required','message'=>'当前项不能为空'],
			['user_phone', 'match','pattern' => '/^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$','message'=>'请输入正确的手机'],
            ['verifyCode', 'captcha', 'captchaAction' => 'center/captcha'],
            ['user_phone', 'unique', 'targetAttribute' => 'user_phone',  'message'=>'手机号已被占用'],
        ];
    }

	public function attributeLabels()
	{
		return [
			'verifyCode'=>'',
			'user_phone'=>'',
		];
	}
}
